package o;

import android.content.Context;
import android.view.ActionMode;
import android.view.ActionMode.Callback;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.d;
import java.util.ArrayList;
import o.aw.c;

@RestrictTo({d.LIBRARY_GROUP})
public class ba extends ActionMode {
    final Context ˊ;
    final aw ॱ;

    @RestrictTo({d.LIBRARY_GROUP})
    public static class a implements c {
        final ArrayList<ba> ˊ = new ArrayList();
        final Callback ˋ;
        final Context ˎ;
        final dy<Menu, Menu> ˏ = new dy();

        public a(Context context, Callback callback) {
            this.ˎ = context;
            this.ˋ = callback;
        }

        public boolean ˋ(aw awVar, Menu menu) {
            return this.ˋ.onCreateActionMode(ˊ(awVar), ॱ(menu));
        }

        public boolean ˎ(aw awVar, Menu menu) {
            return this.ˋ.onPrepareActionMode(ˊ(awVar), ॱ(menu));
        }

        public boolean ˎ(aw awVar, MenuItem menuItem) {
            return this.ˋ.onActionItemClicked(ˊ(awVar), bq.ॱ(this.ˎ, (gk) menuItem));
        }

        public void ˎ(aw awVar) {
            this.ˋ.onDestroyActionMode(ˊ(awVar));
        }

        private Menu ॱ(Menu menu) {
            Menu menu2 = (Menu) this.ˏ.get(menu);
            if (menu2 != null) {
                return menu2;
            }
            menu2 = bq.ˎ(this.ˎ, (gi) menu);
            this.ˏ.put(menu, menu2);
            return menu2;
        }

        public ActionMode ˊ(aw awVar) {
            int size = this.ˊ.size();
            for (int i = 0; i < size; i++) {
                ba baVar = (ba) this.ˊ.get(i);
                if (baVar != null && baVar.ॱ == awVar) {
                    return baVar;
                }
            }
            ActionMode baVar2 = new ba(this.ˎ, awVar);
            this.ˊ.add(baVar2);
            return baVar2;
        }
    }

    public ba(Context context, aw awVar) {
        this.ˊ = context;
        this.ॱ = awVar;
    }

    public Object getTag() {
        return this.ॱ.ʼ();
    }

    public void setTag(Object obj) {
        this.ॱ.ˎ(obj);
    }

    public void setTitle(CharSequence charSequence) {
        this.ॱ.ˋ(charSequence);
    }

    public void setSubtitle(CharSequence charSequence) {
        this.ॱ.ˏ(charSequence);
    }

    public void invalidate() {
        this.ॱ.ˎ();
    }

    public void finish() {
        this.ॱ.ॱ();
    }

    public Menu getMenu() {
        return bq.ˎ(this.ˊ, (gi) this.ॱ.ˏ());
    }

    public CharSequence getTitle() {
        return this.ॱ.ʽ();
    }

    public void setTitle(int i) {
        this.ॱ.ॱ(i);
    }

    public CharSequence getSubtitle() {
        return this.ॱ.ॱॱ();
    }

    public void setSubtitle(int i) {
        this.ॱ.ˊ(i);
    }

    public View getCustomView() {
        return this.ॱ.ᐝ();
    }

    public void setCustomView(View view) {
        this.ॱ.ˎ(view);
    }

    public MenuInflater getMenuInflater() {
        return this.ॱ.ˋ();
    }

    public boolean getTitleOptionalHint() {
        return this.ॱ.ˊॱ();
    }

    public void setTitleOptionalHint(boolean z) {
        this.ॱ.ˋ(z);
    }

    public boolean isTitleOptional() {
        return this.ॱ.ʻ();
    }
}
